package com.ahoi.controller;

import com.ahoi.common.base.BaseController;
import com.ahoi.common.base.ResponseJson;
import com.ahoi.common.exception.BizException;
import com.ahoi.model.User;
import com.ahoi.service.LoginService;
import com.ahoi.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;


@RestController
@RequestMapping(value = "User")
public class UserController extends BaseController {

    @Autowired
    private UserService userService;

    /**
     * 登录
     */
    @RequestMapping(value = "/list")
    public void list(HttpServletRequest request, HttpServletResponse response, User query) {
        try {

            List<User> list = userService.list(query);
            ResponseJson.writeSuccess(response, list);
        } catch (Exception e) {
            e.printStackTrace();
            ResponseJson.writeError(response);
        }
    }
}
